package xiangMu.car;

public class Car extends Auto {       //轿车类
    private String type;    //型号

    public Car() {  ////无参构造方法
    }

    public Car(String carNumber, String brand, int dayRent, int seatNumber, String type, boolean state, int record) {
        super(carNumber, brand, dayRent, seatNumber, state, record);
        this.type = type;
    }

    @Override
    public double calcRent(int days) {
        double sumRent = getDayRent() * days;
        if (days > 150) {
            sumRent *= 0.7;
        } else if (days > 30) {
            sumRent *= 0.8;
        } else if (days > 7) {
            sumRent *= 0.9;
        }
        return sumRent;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "轿车  " + getBrand() + type + ",车牌：" + getCarNumber() + "," + getSeatNumber() + "座，日租金：¥" + getDayRent() + "元，";
    }
}
